package com.codrim.cs.data.server.dao.entity;

import com.codrim.cs.data.rpc.dto.ReportRecordDTO;

import org.springframework.beans.BeanUtils;

import java.util.Date;

import lombok.Data;

/**
 * 报表运行记录 Created by Liang.Zhuge on 07/07/2017.
 */
@Data
public class ReportRecordDO {
    /**
     * 主键
     */
    private Integer id;
    /**
     * 统计范围:开始时间戳
     */
    private Long beginTime;
    /**
     * 统计范围:结束时间戳
     */
    private Long endTime;
    /**
     * 记录创建时间
     */
    private Date createTime;
    /**
     * 统计花费时间,单位:毫秒
     */
    private Long costInMs;
    /**
     * 时区
     */
    private String zone;

    public ReportRecordDO() {
    }

    public ReportRecordDO(ReportRecordDTO dto) {
        BeanUtils.copyProperties(dto, this);
    }

    public ReportRecordDTO toReportRecordDTO() {
        ReportRecordDTO dto = new ReportRecordDTO();
        dto.setId(id);
        dto.setBeginTime(beginTime);
        dto.setEndTime(endTime);
        dto.setCreateTime(this.createTime);
        dto.setCostInMs(this.costInMs);
        return dto;
    }
}
